//
//  YHPictureCell.swift
//  WeiBoYH
//
//  Created by yanhui on 2017/1/9.
//  Copyright © 2017年 yanhui. All rights reserved.
//

import UIKit

class YHPictureCell: UICollectionViewCell {
    
    var pictureInfo: YHPictureInfo? {
        didSet {
            let url = URL(string: pictureInfo?.thumbnail_pic ?? "")
            iconView.sd_setImage(with: url)
        }
    }
    //添加图片
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func setupUI() {
        //添加子视图
        self.contentView.addSubview(iconView)
        //添加约束
        iconView.snp.makeConstraints { (make) in
            make.edges.equalTo(self.contentView)
        }
    }
    
    //懒加载图片视图
    lazy var iconView: UIImageView = {
        let iv = UIImageView()
        
        return iv
    }()
    
}

    

